//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Thu Mar 17 10:27:30 2011 by ROOT version 5.28/00
// from TChain Nt/
//////////////////////////////////////////////////////////

#ifndef Analysis2_h
#define Analysis2_h

#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <vector>
#include <string>
#include <TH1F.h>
#include <TH2F.h>
#include <TH3F.h>

using namespace std;


class Analysis2 {
public :
  bool DEBUG;
  int nbjets;

  TH1F* metcf[13];
  TH1F* met_brpv[8];
  TH1F* meff_brpv[8];
  TH1F* mt_brpv[8];
  TH1F* st_brpv[8];
  TH1F* ht_brpv[8];
  TH1F* met_over_meff_brpv[8];
  TH1F* mx_brpv[8];
  TH1F* mjj_brpv[8];
  TH1F* DRjj_brpv[8];
  TH1F* DRmujj_brpv[8];
  TH1F* mupt_brpv[8];
  TH1F* jjpt_brpv[8]; 
  TH1F* nm_brpv[8]; 
  TH1F* nj_brpv[8]; 
  TH1F* nw_brpv[8]; 
  TH1F* nx_brpv[8]; 



  TH2F* st_vs_ht_brpv[8];
  TH2F* st_vs_met_brpv[8];
  TH2F* st_vs_meff_brpv[8];
  TH2F* st_vs_mt_brpv[8]; 
  TH2F* mt_vs_met_brpv[8];
  TH2F* mt_vs_meff_brpv[8];
  TH2F* mt_vs_ht_brpv[8];
  TH2F* ht_vs_met_brpv[8];

  TH3F* st_vs_mt_vs_meff_brpv[8];


  /*
  TH2F* hh01;
  TH2F* hh02;
  TH2F* hh03;
  TH1F* h01;
  TH1F* h02;
  TH1F* h03;
  TH1F* h04;
  TH1F* h05;
  TH1F* h06;
  TH1F* h07;
  TH1F* h08;
  TH1F* h09;
  TH1F* h10;

  TH1F* q[17];
  TH2F* qq[8];
  */


   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
   Int_t           fCurrent; //!current Tree number in a TChain

   // Declaration of leaf types
   Char_t          isGoodPV;
   Char_t          wasCrackElectron;
   Char_t          wasCrackElectronMET;
   Char_t          wasCrack;
   Char_t          wasBadJet;
   Char_t          wasCosmicMuon;
   vector<double>  *DeltaR_Wmu;
   vector<double>  *DeltaPhi_Wmu;
   vector<double>  *DeltaEta_Wmu;
   vector<double>  *m_Wmu;
   vector<double>  *pt_Wmu;
   vector<double>  *DeltaR_jj;
   vector<double>  *DeltaEta_jj;
   vector<double>  *DeltaPhi_jj;
   vector<double>  *pt_jj;
   vector<double>  *m_jj;
   vector<double>  *MuEtCone20;
   vector<double>  *MuPt;
   vector<double>  *MuPtms;
   vector<double>  *MuEta;
   vector<double>  *MuPhi;
   vector<double>  *MuEnergy;
   vector<double>  *Mud0_exPV;
   vector<double>  *Mud0_exPVe;
   vector<double>  *Muz0_exPV;
   vector<double>  *Mur0_exPV;
   vector<double>  *MTs;
   vector<double>  *DeltaRMetJet;
   vector<double>  *DeltaPhiMetJet;
   vector<double>  *JetEnergy;
   vector<double>  *JetPt;
   vector<double>  *JetEta;
   vector<double>  *JetPhi;
   vector<double>  *JetFlavorWeightSV0;
   vector<double>  *JetEMJES;
   vector<double>  *ElEnergy;
   vector<double>  *ElPt;
   vector<double>  *ElEta;
   vector<double>  *ElPhi;
   Float_t         myEventWeight;
   vector<int>     *vx_nTracks;
   Int_t           MuN;
   Int_t           ElN;
   Int_t           ElNBeforeOR;
   Int_t           MuNBeforeOR;
   Int_t           JetN;
   Int_t           JetNBeforeOR;
   Double_t        em_muonjetjet;
   Double_t        em_muonjetjetjet;
   Double_t        ht_muonjetjet;
   Double_t        ht_muonjetjetjet;
   Double_t        met;
   Double_t        metx;
   Double_t        mety;
   Double_t        mysummupx;
   Double_t        mysummupy;
   Double_t        mysumelpx;
   Double_t        mysumelpy;
   Double_t        mysumjepx;
   Double_t        mysumjepy;
   Double_t        NewMetPhi;
   Float_t         MET_EMJES_RefFinal_CellOutEM_phi;
   Float_t         MET_EMJES_Muon_Total_Staco_etx;
   Float_t         MET_EMJES_Muon_Total_Staco_ety;
   Float_t         MET_EMJES_RefFinal_CellOutEM_etx;
   Float_t         MET_EMJES_RefFinal_CellOutEM_ety;
   Double_t        ts;
   Double_t        deltaphimin;
   Double_t        asymmetry;
   Char_t          EF_mu13;
   Char_t          EF_mu13_tight;
   Char_t          EF_mu10_MSonly;
   Char_t          L1_MU6;
   Char_t          L1_2J15;
   Char_t          L1_TAU11;
   Char_t          MuTrigger;
   Double_t        miEscala;
   Double_t        mikFactor;
   Int_t           RunNumber;
   Int_t           EventNumber;
   Int_t           lbn;
   Char_t          wasjptlet30;

   // List of branches
   TBranch        *b_isGoodPV;   //!
   TBranch        *b_wasCrackElectron;   //!
   TBranch        *b_wasCrackElectronMET;   //!
   TBranch        *b_wasCrack;   //!
   TBranch        *b_wasBadJet;   //!
   TBranch        *b_wasCosmicMuon;   //!
   TBranch        *b_DeltaR_Wmu;   //!
   TBranch        *b_DeltaPhi_Wmu;   //!
   TBranch        *b_DeltaEta_Wmu;   //!
   TBranch        *b_m_Wmu;   //!
   TBranch        *b_pt_Wmu;   //!
   TBranch        *b_DeltaR_jj;   //!
   TBranch        *b_DeltaEta_jj;   //!
   TBranch        *b_DeltaPhi_jj;   //!
   TBranch        *b_pt_jj;   //!
   TBranch        *b_m_jj;   //!
   TBranch        *b_MuEtCone20;   //!
   TBranch        *b_MuPt;   //!
   TBranch        *b_MuPtms;   //!
   TBranch        *b_MuEta;   //!
   TBranch        *b_MuPhi;   //!
   TBranch        *b_MuEnergy;   //!
   TBranch        *b_Mud0_exPV;   //!
   TBranch        *b_Mud0_exPVe;   //!
   TBranch        *b_Muz0_exPV;   //!
   TBranch        *b_Mur0_exPV;   //!
   TBranch        *b_MTs;   //!
   TBranch        *b_DeltaRMetJet;   //!
   TBranch        *b_DeltaPhiMetJet;   //!
   TBranch        *b_JetEnergy;   //!
   TBranch        *b_JetPt;   //!
   TBranch        *b_JetEta;   //!
   TBranch        *b_JetPhi;   //!
   TBranch        *b_JetFlavorWeightSV0;   //!
   TBranch        *b_JetEMJES;   //!
   TBranch        *b_ElEnergy;   //!
   TBranch        *b_ElPt;   //!
   TBranch        *b_ElEta;   //!
   TBranch        *b_ElPhi;   //!
   TBranch        *b_myEventWeight;   //!
   TBranch        *b_vx_nTracks;   //!
   TBranch        *b_MuN;   //!
   TBranch        *b_ElN;   //!
   TBranch        *b_ElNBeforeOR;   //!
   TBranch        *b_MuNBeforeOR;   //!
   TBranch        *b_JetN;   //!
   TBranch        *b_JetNBeforeOR;   //!
   TBranch        *b_em_muonjetjet;   //!
   TBranch        *b_em_muonjetjetjet;   //!
   TBranch        *b_ht_muonjetjet;   //!
   TBranch        *b_ht_muonjetjetjet;   //!
   TBranch        *b_met;   //!
   TBranch        *b_metx;   //!
   TBranch        *b_mety;   //!
   TBranch        *b_mysummupx;   //!
   TBranch        *b_mysummupy;   //!
   TBranch        *b_mysumelpx;   //!
   TBranch        *b_mysumelpy;   //!
   TBranch        *b_mysumjepx;   //!
   TBranch        *b_mysumjepy;   //!
   TBranch        *b_NewMetPhi;   //!
   TBranch        *b_MET_EMJES_RefFinal_CellOutEM_phi;   //!
   TBranch        *b_MET_EMJES_Muon_Total_Staco_etx;   //!
   TBranch        *b_MET_EMJES_Muon_Total_Staco_ety;   //!
   TBranch        *b_MET_EMJES_RefFinal_CellOutEM_etx;   //!
   TBranch        *b_MET_EMJES_RefFinal_CellOutEM_ety;   //!
   TBranch        *b_ts;   //!
   TBranch        *b_deltaphimin;   //!
   TBranch        *b_asymmetry;   //!
   TBranch        *b_EF_mu13;   //!
   TBranch        *b_EF_mu13_tight;   //!
   TBranch        *b_EF_mu10_MSonly;   //!
   TBranch        *b_L1_MU6;   //!
   TBranch        *b_L1_2J15;   //!
   TBranch        *b_L1_TAU11;   //!
   TBranch        *b_MuTrigger;   //!
   TBranch        *b_miEscala;   //!
   TBranch        *b_mikFactor;   //!
   TBranch        *b_RunNumber;   //!
   TBranch        *b_EventNumber;   //!
   TBranch        *b_lbn;   //!
   TBranch        *b_wasjptlet30;   //!

   Analysis2(TTree *tree=0);
   Analysis2(string inputFile);
   virtual ~Analysis2();
   virtual Int_t    Cut(Long64_t entry);
   virtual Int_t    GetEntry(Long64_t entry);
   virtual Long64_t LoadTree(Long64_t entry);
   virtual void     Init(TTree *tree);
   virtual void     Loop();
   virtual Bool_t   Notify();
   virtual void     Show(Long64_t entry = -1);
};

#endif

#ifdef Analysis2_cxx
Analysis2::Analysis2(TTree *tree)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
   if (tree == 0) {

#ifdef SINGLE_TREE
      // The following code should be used if you want this class to access
      // a single tree instead of a chain
      TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("Memory Directory");
      if (!f) {
         f = new TFile("Memory Directory");
         f->cd("Rint:/");
      }
      tree = (TTree*)gDirectory->Get("Nt");

#else // SINGLE_TREE

      // The following code should be used if you want this class to access a chain
      // of trees.
      TChain * chain = new TChain("Nt","");
      chain->Add("/PUC_data2/110315/user.quinonez.SUSYFILE.muon.110316.run00167575.V0.110316003700/user.quinonez.011133._00005.file.root/Nt");
      tree = chain;
#endif // SINGLE_TREE

   }
   Init(tree);
}

Analysis2::~Analysis2()
{
   if (!fChain) return;
   delete fChain->GetCurrentFile();
}

Int_t Analysis2::GetEntry(Long64_t entry)
{
// Read contents of entry.
   if (!fChain) return 0;
   return fChain->GetEntry(entry);
}
Long64_t Analysis2::LoadTree(Long64_t entry)
{
// Set the environment to read one entry
   if (!fChain) return -5;
   Long64_t centry = fChain->LoadTree(entry);
   if (centry < 0) return centry;
   if (!fChain->InheritsFrom(TChain::Class()))  return centry;
   TChain *chain = (TChain*)fChain;
   if (chain->GetTreeNumber() != fCurrent) {
      fCurrent = chain->GetTreeNumber();
      Notify();
   }
   return centry;
}

void Analysis2::Init(TTree *tree)
{
   // The Init() function is called when the selector needs to initialize
   // a new tree or chain. Typically here the branch addresses and branch
   // pointers of the tree will be set.
   // It is normally not necessary to make changes to the generated
   // code, but the routine can be extended by the user if needed.
   // Init() will be called many times when running on PROOF
   // (once per file to be processed).

   // Set object pointer
   DeltaR_Wmu = 0;
   DeltaPhi_Wmu = 0;
   DeltaEta_Wmu = 0;
   m_Wmu = 0;
   pt_Wmu = 0;
   DeltaR_jj = 0;
   DeltaEta_jj = 0;
   DeltaPhi_jj = 0;
   pt_jj = 0;
   m_jj = 0;
   MuEtCone20 = 0;
   MuPt = 0;
   MuPtms = 0;
   MuEta = 0;
   MuPhi = 0;
   MuEnergy = 0;
   Mud0_exPV = 0;
   Mud0_exPVe = 0;
   Muz0_exPV = 0;
   Mur0_exPV = 0;
   MTs = 0;
   DeltaRMetJet = 0;
   DeltaPhiMetJet = 0;
   JetEnergy = 0;
   JetPt = 0;
   JetEta = 0;
   JetPhi = 0;
   JetFlavorWeightSV0 = 0;
   JetEMJES = 0;
   ElEnergy = 0;
   ElPt = 0;
   ElEta = 0;
   ElPhi = 0;
   vx_nTracks = 0;
   // Set branch addresses and branch pointers
   if (!tree) return;
   fChain = tree;
   fCurrent = -1;
   fChain->SetMakeClass(1);

   fChain->SetBranchAddress("isGoodPV", &isGoodPV, &b_isGoodPV);
   fChain->SetBranchAddress("wasCrackElectron", &wasCrackElectron, &b_wasCrackElectron);
   fChain->SetBranchAddress("wasCrackElectronMET", &wasCrackElectronMET, &b_wasCrackElectronMET);
   fChain->SetBranchAddress("wasCrack", &wasCrack, &b_wasCrack);
   fChain->SetBranchAddress("wasBadJet", &wasBadJet, &b_wasBadJet);
   fChain->SetBranchAddress("wasCosmicMuon", &wasCosmicMuon, &b_wasCosmicMuon);
   fChain->SetBranchAddress("DeltaR_Wmu", &DeltaR_Wmu, &b_DeltaR_Wmu);
   fChain->SetBranchAddress("DeltaPhi_Wmu", &DeltaPhi_Wmu, &b_DeltaPhi_Wmu);
   fChain->SetBranchAddress("DeltaEta_Wmu", &DeltaEta_Wmu, &b_DeltaEta_Wmu);
   fChain->SetBranchAddress("m_Wmu", &m_Wmu, &b_m_Wmu);
   fChain->SetBranchAddress("pt_Wmu", &pt_Wmu, &b_pt_Wmu);
   fChain->SetBranchAddress("DeltaR_jj", &DeltaR_jj, &b_DeltaR_jj);
   fChain->SetBranchAddress("DeltaEta_jj", &DeltaEta_jj, &b_DeltaEta_jj);
   fChain->SetBranchAddress("DeltaPhi_jj", &DeltaPhi_jj, &b_DeltaPhi_jj);
   fChain->SetBranchAddress("pt_jj", &pt_jj, &b_pt_jj);
   fChain->SetBranchAddress("m_jj", &m_jj, &b_m_jj);
   fChain->SetBranchAddress("MuEtCone20", &MuEtCone20, &b_MuEtCone20);
   fChain->SetBranchAddress("MuPt", &MuPt, &b_MuPt);
   fChain->SetBranchAddress("MuPtms", &MuPtms, &b_MuPtms);
   fChain->SetBranchAddress("MuEta", &MuEta, &b_MuEta);
   fChain->SetBranchAddress("MuPhi", &MuPhi, &b_MuPhi);
   fChain->SetBranchAddress("MuEnergy", &MuEnergy, &b_MuEnergy);
   fChain->SetBranchAddress("Mud0_exPV", &Mud0_exPV, &b_Mud0_exPV);
   fChain->SetBranchAddress("Mud0_exPVe", &Mud0_exPVe, &b_Mud0_exPVe);
   fChain->SetBranchAddress("Muz0_exPV", &Muz0_exPV, &b_Muz0_exPV);
   fChain->SetBranchAddress("Mur0_exPV", &Mur0_exPV, &b_Mur0_exPV);
   fChain->SetBranchAddress("MTs", &MTs, &b_MTs);
   fChain->SetBranchAddress("DeltaRMetJet", &DeltaRMetJet, &b_DeltaRMetJet);
   fChain->SetBranchAddress("DeltaPhiMetJet", &DeltaPhiMetJet, &b_DeltaPhiMetJet);
   fChain->SetBranchAddress("JetEnergy", &JetEnergy, &b_JetEnergy);
   fChain->SetBranchAddress("JetPt", &JetPt, &b_JetPt);
   fChain->SetBranchAddress("JetEta", &JetEta, &b_JetEta);
   fChain->SetBranchAddress("JetPhi", &JetPhi, &b_JetPhi);
   fChain->SetBranchAddress("JetFlavorWeightSV0", &JetFlavorWeightSV0, &b_JetFlavorWeightSV0);
   fChain->SetBranchAddress("JetEMJES", &JetEMJES, &b_JetEMJES);
   fChain->SetBranchAddress("ElEnergy", &ElEnergy, &b_ElEnergy);
   fChain->SetBranchAddress("ElPt", &ElPt, &b_ElPt);
   fChain->SetBranchAddress("ElEta", &ElEta, &b_ElEta);
   fChain->SetBranchAddress("ElPhi", &ElPhi, &b_ElPhi);
   fChain->SetBranchAddress("myEventWeight", &myEventWeight, &b_myEventWeight);
   fChain->SetBranchAddress("vx_nTracks", &vx_nTracks, &b_vx_nTracks);
   fChain->SetBranchAddress("MuN", &MuN, &b_MuN);
   fChain->SetBranchAddress("ElN", &ElN, &b_ElN);
   fChain->SetBranchAddress("ElNBeforeOR", &ElNBeforeOR, &b_ElNBeforeOR);
   fChain->SetBranchAddress("MuNBeforeOR", &MuNBeforeOR, &b_MuNBeforeOR);
   fChain->SetBranchAddress("JetN", &JetN, &b_JetN);
   fChain->SetBranchAddress("JetNBeforeOR", &JetNBeforeOR, &b_JetNBeforeOR);
   fChain->SetBranchAddress("em_muonjetjet", &em_muonjetjet, &b_em_muonjetjet);
   fChain->SetBranchAddress("em_muonjetjetjet", &em_muonjetjetjet, &b_em_muonjetjetjet);
   fChain->SetBranchAddress("ht_muonjetjet", &ht_muonjetjet, &b_ht_muonjetjet);
   fChain->SetBranchAddress("ht_muonjetjetjet", &ht_muonjetjetjet, &b_ht_muonjetjetjet);
   fChain->SetBranchAddress("met", &met, &b_met);
   fChain->SetBranchAddress("metx", &metx, &b_metx);
   fChain->SetBranchAddress("mety", &mety, &b_mety);
   fChain->SetBranchAddress("mysummupx", &mysummupx, &b_mysummupx);
   fChain->SetBranchAddress("mysummupy", &mysummupy, &b_mysummupy);
   fChain->SetBranchAddress("mysumelpx", &mysumelpx, &b_mysumelpx);
   fChain->SetBranchAddress("mysumelpy", &mysumelpy, &b_mysumelpy);
   fChain->SetBranchAddress("mysumjepx", &mysumjepx, &b_mysumjepx);
   fChain->SetBranchAddress("mysumjepy", &mysumjepy, &b_mysumjepy);
   fChain->SetBranchAddress("NewMetPhi", &NewMetPhi, &b_NewMetPhi);
   fChain->SetBranchAddress("MET_EMJES_RefFinal_CellOutEM_phi", &MET_EMJES_RefFinal_CellOutEM_phi, &b_MET_EMJES_RefFinal_CellOutEM_phi);
   fChain->SetBranchAddress("MET_EMJES_Muon_Total_Staco_etx", &MET_EMJES_Muon_Total_Staco_etx, &b_MET_EMJES_Muon_Total_Staco_etx);
   fChain->SetBranchAddress("MET_EMJES_Muon_Total_Staco_ety", &MET_EMJES_Muon_Total_Staco_ety, &b_MET_EMJES_Muon_Total_Staco_ety);
   fChain->SetBranchAddress("MET_EMJES_RefFinal_CellOutEM_etx", &MET_EMJES_RefFinal_CellOutEM_etx, &b_MET_EMJES_RefFinal_CellOutEM_etx);
   fChain->SetBranchAddress("MET_EMJES_RefFinal_CellOutEM_ety", &MET_EMJES_RefFinal_CellOutEM_ety, &b_MET_EMJES_RefFinal_CellOutEM_ety);
   fChain->SetBranchAddress("ts", &ts, &b_ts);
   fChain->SetBranchAddress("deltaphimin", &deltaphimin, &b_deltaphimin);
   fChain->SetBranchAddress("asymmetry", &asymmetry, &b_asymmetry);
   fChain->SetBranchAddress("EF_mu13", &EF_mu13, &b_EF_mu13);
   fChain->SetBranchAddress("EF_mu13_tight", &EF_mu13_tight, &b_EF_mu13_tight);
   fChain->SetBranchAddress("EF_mu10_MSonly", &EF_mu10_MSonly, &b_EF_mu10_MSonly);
   fChain->SetBranchAddress("L1_MU6", &L1_MU6, &b_L1_MU6);
   fChain->SetBranchAddress("L1_2J15", &L1_2J15, &b_L1_2J15);
   fChain->SetBranchAddress("L1_TAU11", &L1_TAU11, &b_L1_TAU11);
   fChain->SetBranchAddress("MuTrigger", &MuTrigger, &b_MuTrigger);
   fChain->SetBranchAddress("miEscala", &miEscala, &b_miEscala);
   fChain->SetBranchAddress("mikFactor", &mikFactor, &b_mikFactor);
   fChain->SetBranchAddress("RunNumber", &RunNumber, &b_RunNumber);
   fChain->SetBranchAddress("EventNumber", &EventNumber, &b_EventNumber);
   fChain->SetBranchAddress("lbn", &lbn, &b_lbn);
   fChain->SetBranchAddress("wasjptlet30", &wasjptlet30, &b_wasjptlet30);
   Notify();
}

Bool_t Analysis2::Notify()
{
   // The Notify() function is called when a new file is opened. This
   // can be either for a new TTree in a TChain or when when a new TTree
   // is started when using PROOF. It is normally not necessary to make changes
   // to the generated code, but the routine can be extended by the
   // user if needed. The return value is currently not used.

   return kTRUE;
}

void Analysis2::Show(Long64_t entry)
{
// Print contents of entry.
// If entry is not specified, print current entry
   if (!fChain) return;
   fChain->Show(entry);
}
Int_t Analysis2::Cut(Long64_t entry)
{
// This function may be called from Loop.
// returns  1 if entry is accepted.
// returns -1 otherwise.
   return 1;
}
#endif // #ifdef Analysis2_cxx
